package com.nanhai.buddhist.college.module.study.controller.student.studyadditionalcourses;

import com.nanhai.buddhist.college.framework.common.pojo.CommonResult;
import com.nanhai.buddhist.college.module.study.controller.admin.studyadditionalcourses.vo.StudyAdditionalCoursesStudentCreateReqVO;
import com.nanhai.buddhist.college.module.study.service.studyadditionalcourses.StudyAdditionalCoursesStudentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

import static com.nanhai.buddhist.college.framework.common.pojo.CommonResult.success;

@Api(tags = "学生后台 - 学生选课")
@RestController
@RequestMapping("/study/student/additional-courses-student")
@Validated
public class StudentStudyAdditionalCoursesStudentController {

    @Resource
    private StudyAdditionalCoursesStudentService additionalCoursesStudentService;

    @PostMapping("/create")
    @ApiOperation("创建学生选课")
    public CommonResult<String> createAdditionalCoursesStudent(@Valid @RequestBody StudyAdditionalCoursesStudentCreateReqVO createReqVO) {
        return success(additionalCoursesStudentService.createAdditionalCoursesStudent(createReqVO));
    }


    @PostMapping("/backAdditionalCourses")
    @ApiOperation("学生退课选课")
    public CommonResult<String> backAdditionalCoursesStudent(@Valid @RequestBody StudyAdditionalCoursesStudentCreateReqVO createReqVO) {
        return success(additionalCoursesStudentService.backAdditionalCoursesByStudent(createReqVO));
    }





}